package com.sls.game.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sls.game.dao.EbaimiCheckFileDAO;
import com.sls.game.page.Pagination;
import com.sls.game.pojo.ebaimi.EbaimiCheckFileInfo;

/**
 * 
 * @Description：易百米对账文件DAO
 * @author Wangxuegang
 * @Date：2013-5-16
 * 
 */
@Repository("ebaimiCheckFileDAO")
public class EbaimiCheckFileDAOImpl extends SuperDAO<EbaimiCheckFileInfo>
		implements EbaimiCheckFileDAO {

	/**
	 * 记录插入
	 * 
	 * @param info
	 */
	@Override
	public void insertInfo(EbaimiCheckFileInfo info) {
		this.getSqlSession().insert("mybatis.xml.EbaimiBillMapper.insertInfo",
				info);
	}

	/**
	 * 分页查询
	 * 
	 * @param eInfo
	 * @return
	 */
	@Override
	public Pagination<EbaimiCheckFileInfo> queryPaginationList(
			EbaimiCheckFileInfo info) {
		Pagination<EbaimiCheckFileInfo> paginationList = null;
		Integer rowCount = queryRowCount(info);

		info.calculate();
		List<EbaimiCheckFileInfo> list = queryInfoList(info);
		paginationList = this.queryPagination(rowCount, list, info);
		return paginationList;
	}

	/**
	 * 记录结果集list
	 * 
	 * @param enLinkGoodsInfo
	 * @return
	 */
	private List<EbaimiCheckFileInfo> queryInfoList(EbaimiCheckFileInfo info) {
		List<EbaimiCheckFileInfo> list = this.getSqlSession().selectList(
				"mybatis.xml.EbaimiBillMapper.queryInfoList", info);
		return list;
	}

	/**
	 * 查询记录总数
	 * 
	 * @param enLinkGoodsInfo
	 * @return
	 */
	private Integer queryRowCount(EbaimiCheckFileInfo info) {
		Integer rowCount = this.getSqlSession().selectOne(
				"mybatis.xml.EbaimiBillMapper.queryRowCount", info);
		return rowCount;
	}

	/**
	 * 查询记录是否存在
	 * 
	 * @param oid_goodsorder
	 * @return
	 */
	@Override
	public String queryPrimaryKey(String oid_goodsorder) {
		String primaryKey = null;
		primaryKey = this.getSqlSession().selectOne(
				"mybatis.xml.EbaimiBillMapper.queryPrimaryKey", oid_goodsorder);
		return primaryKey;
	}

	/**
	 * 记录更新
	 * 
	 * @param info
	 */
	@Override
	public void updateInfo(EbaimiCheckFileInfo checkInfo) {
		this.getSqlSession().update("mybatis.xml.EbaimiBillMapper.updateInfo",
				checkInfo);
	}

}
